const express = require('express')
const router = express.Router()
const news_handler = require('../router_handler/type')

const expressJoi = require('@escook/express-joi')
const {add_cate_schema,
       delete_cate_schema,
       get_cate_schema,
       update_cate_schema
    } = require('../schema/type')


// 获取分类的列表数据
router.get('/cates',news_handler.getCates)
router.post('/catesactivity/:typeId',news_handler.getCatesActivity)
// 新增分类的列表数据
router.post('/addcates',news_handler.addCates)
// 删除分类的列表数据
router.get('/deletecate/:typeId',expressJoi(delete_cate_schema),news_handler.deleteCateById)
// 根据Id获取分类
router.get('/cates/:typeName',news_handler.getCateByName)
// 根据ID更新分类
router.post('/updatecate',expressJoi(update_cate_schema),news_handler.updateCateById)
module.exports = router